#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

char*const newenv="DAN=123";
int main()
{
    printf("父进程开始执行\n");
    if(fork()==0)
    {
        printf("子进程开始执行\n");
       // execl("./check","check",NULL);
       //execl("/usr/bin/ls","-a","-l",NULL);
       //execl("./unflod","-a","-b","-c",NULL);
       //execlp("ls","ls","-l","-a",NULL);
       //execv("/usr/bin/ls",argv);
       //execvp("ls",argv);
        char*argv[]={
            "unflod",
            "-b",
            "-a",
            NULL
        };
       extern char** environ;
       putenv(newenv);
       execvpe("./unflod",argv,environ);
    }
        waitpid(-1,NULL,0);
        printf("父进程运行结束\n");
}

